﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Scan
{
    public partial class MainMenuView : BaseView
    {
        public MainMenuView()
        {
            InitializeComponent();
            this.Title = "主菜单";
        }

        public override void OnLoad()
        {
            btnPurchase.Focus();
        }

        // 采购入库单
        public override void NumPad1(object sender, EventArgs e)
        {
            this.ParentForm.LoadView(typeof(VouchStockInPut), this, true, false);
        }

        // 销售出库单
        public override void NumPad2(object sender, EventArgs e)
        {
            //this.ParentForm.LoadView(typeof(Vouch_WhEntryPur), true, false);
        }

        // 价格/库存查询
        public override void NumPad3(object sender, EventArgs e)
        {
            //this.ParentForm.LoadView(typeof(Vouch_WhEntryPur), true, false);
        }

        // 库存盘点
        public override void NumPad4(object sender, EventArgs e)
        {
            //this.ParentForm.LoadView(typeof(Vouch_WhEntryPur), true, false);
        }

        // 单据查询
        public override void NumPad5(object sender, EventArgs e)
        {
            //this.ParentForm.LoadView(typeof(Vouch_WhEntryPur), true, false);
        }

        // 系统管理
        public override void NumPad6(object sender, EventArgs e)
        {
            //if (SysUser.LoginUser != null)
            //{
            //    if (SysUser.LoginUser.PurviewCode.ToLower() == "admin")
            //    {
            //        this.ParentForm.LoadView(typeof(SystemManagerMenu), this, true, false);
            //    }
            //    else
            //    {
            //        //throw new Exception("您没有系统管理的权限，不能操作此项！");
            //        MessageBox.Show("您没有系统管理的权限，不能操作此项！", "系统提示！", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
            //    }
            //}
        }

        // 注销登陆
        public override void Escape(object sender, EventArgs e)
        {
            if (this.ParentForm != null)
            {
                this.ParentForm.LoadView(this.ResultView.GetType(), null, true, false);
            }
        }

        /// <summary>
        /// 销售发货单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSale_Click(object sender, EventArgs e)
        {
            this.ParentForm.LoadView(typeof(VouchDispatchList), this, true, false);
        }
    }
}
